﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GNSCore.Model;
using WinVerificationService.AlertsService;

namespace WinVerificationService.Helpers
{
    /// <summary>
    /// For notifing user about alets
    /// </summary>
    public static class NotificationHelper
    {
        internal static void NotifyUser(string username, WinVerificationService.UserSettingsService.UserSettingsServiceClient _userSettingsServiceClient, List<BaseAlert> alerts)
        {
            UserSettings settings = _userSettingsServiceClient.GetUserSettings(username);

            if (settings.UseSMS)
            {
                string alertMessage = string.Format("GNS Team: Fuck!!! Alert!!! {0}",alerts.FirstOrDefault().NotificationDescription.notification.Substring(0,30));
                SMSServices.Sender.MessageSender.SendMessageFromIPIPI(SettingsHelper.IpipiUsername, SettingsHelper.IpipiPassword, settings.PhoneNumber, alertMessage);
            }
        }
    }
}
